package com.icez.demo

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import androidx.databinding.ObservableArrayList
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.OnScrollListener
import com.icez.base_util_library.LogUtil
import com.icez.base_util_library.StatusBarUtil
import com.icez.base_util_library.ViewUtil
import com.icez.base_util_library.activity.BaseActivity
import com.icez.demo.adapter.MainAdapter
import com.icez.demo.databinding.ActivityMainBinding

class MainActivity : BaseActivity<ActivityMainBinding>() {

    private val mDatas = ObservableArrayList<String>()
    private var mMainAdapter:MainAdapter ?= null

    override fun getBundleParams() {
    }

    override fun getContentView(): Int {
        return R.layout.activity_main
    }

    override fun getStatusBarView(): View? {
        return mBinding?.mainStatusBar
    }

    override fun initClick() {
        ViewUtil.instance.setScrollBarByHorizontalRecyclerView(mBinding?.mainRv,mBinding?.mainRvScrollBg,mBinding?.mainRvScrollBgBar)
    }

    override fun initViewValue() {

        (0 until 20).map {
            mDatas.add("数据$it")
        }
        mMainAdapter = MainAdapter(R.layout.item_main)
        mMainAdapter?.data = mDatas
        mBinding?.mainRv?.layoutManager = GridLayoutManager(this,2,RecyclerView.HORIZONTAL,false)
        mBinding?.mainRv?.adapter = mMainAdapter

    }


}